package com.zcp.proxydemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import java.lang.reflect.Proxy;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        OperateInvoke operateInvoke = new OperateInvoke(new OperateImpl());

        //创建代理对象
        Operate operate = (Operate) Proxy.newProxyInstance(Operate.class.getClassLoader(), new Class[]{Operate.class}, operateInvoke);
        operate.operateMethos1();
        operate.operateMethos2();
        operate.operateMethos3();
    }
}
